<?php
namespace Modules\ShopAdmin\Models;
use Illuminate\Support\Facades\DB;
class ShopProductComment extends BaseShopModel
{	
	/**
     * @name  关联用户
     */
    public function user_to()
    {
        return $this->belongsTo('Modules\Admin\Models\User','user_id','id');
    }
	/**
     * @name  数据格式化
     */
	public function formatting_list($data){
		foreach($data as $k=>$v){
			$data[$k]['nick_name'] = $v['user_to']['nick_name'];
			$data[$k]['phone'] = $v['user_to']['phone'];
			if($v['images']){
				$v['images'] = explode('|',$v['images']);
				$data[$k]['images'] = DB::table('images')->whereIn('id',$v['images'])->get();
			}
		}
		return $data;
	}
}
